﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Frame.Lib.Utilities;

/// <summary>
///PageEdit 的摘要说明
/// </summary>
public class PageEdit:PageBase
{
    private string _pkid;
    /// <summary>
    /// 获得从request中传过来的经过解密的ID
    /// </summary>
    protected virtual string PKID
    {
        get
        {
            if (Request["ID"] != null)
            {
                if (_pkid == null)
                {
                    _pkid = StrUtil.DecryptUrl(Request["ID"]);
                }
                return _pkid;
            }
            else
            {
                return null;
            }
        }
    }

    /// <summary>
    /// 获得从ViewState中的ID
    /// </summary>
    protected virtual string PKID2
    {
        get
        {
            if (!IsPostBack)
            {
                if (Request["ID"] != null)
                {
                    ViewState["ID"] = StrUtil.DecryptDES(Request["ID"]);
                }
            }
            return (string)ViewState["ID"];
        }
        set
        {
            ViewState["ID"] = value;
        }
    }
    protected string HeadTitle
    {
        get
        {
            return Request["Title"];
        }
    }
    public PageEdit()
    {
        //
        //TODO: 在此处添加构造函数逻辑
        //
    }

    protected void EnableUpload()
    {
        this.Form.Attributes.Add("enctype", "multipart/form-data");
    }

    /// <summary>
    /// 给控制赋值
    /// </summary>
    /// <param name="panel"></param>
    /// <param name="info"></param>
    protected void SetControl(Control panel, object info)
    {
        EntityUtil.SetControl(panel, info);
    }

    /// <summary>
    /// 给实体赋值
    /// </summary>
    /// <param name="panel"></param>
    /// <param name="info"></param>
    protected void SetEntity(Panel panel, object info)
    {
        EntityUtil.SetEntity(panel, info);
    }

    /// <summary>
    /// 刷新列表页
    /// </summary>
    protected void RefreshView()
    {
        JSUtil.RefreshView();
    }
}
